Skip to content

增强对 Vulkan 的支持#5930

Merged
Glavo merged 49 commits intoHMCL-dev:mainfrom
Glavo:vulkan
Apr 10, 2026
Merged

增强对 Vulkan 的支持#5930
Glavo merged 49 commits intoHMCL-dev:mainfrom
Glavo:vulkan

Conversation

@Glavo
Copy link
Copy Markdown
Member

@Glavo Glavo commented Apr 8, 2026

  1. 优化渲染器选项描述;
  2. 添加 Vulkan 相关的渲染器选项。

@Glavo Glavo marked this pull request as draft April 8, 2026 13:48
@Glavo Glavo marked this pull request as ready for review April 10, 2026 07:29
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

该 PR 旨在增强启动器对 Vulkan 相关渲染路径的支持,并改进“渲染器”选项的展示文案与可选项,以适配较新的 Minecraft 版本(26.2 snapshot 系列)及 Mesa Loader 相关能力。

Changes:

  • 扩展 Renderer 枚举,引入 Vulkan/OpenGL API 维度与 Vulkan 相关渲染器(如 Lavapipe)。
  • 启动参数与环境变量层面增加 Vulkan/Mesa Loader 支持(--graphicsBackend、Mesa Loader nativeDir、VK_* 环境变量等)。
  • 更新 Windows 平台 mesa-loader 依赖版本,并调整多语言渲染器描述文案/条目。

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
HMCLCore/src/main/java/org/jackhuang/hmcl/launch/DefaultLauncher.java 生成启动命令与环境变量时加入 Vulkan/Mesa Loader 相关参数与变量
HMCLCore/src/main/java/org/jackhuang/hmcl/game/Renderer.java 重构渲染器枚举:引入 API 概念、Vulkan/OpenGL 条目与 Mesa 相关元数据
HMCL/src/main/resources/assets/natives.json 升级 Windows mesa-loader 依赖版本与校验信息
HMCL/src/main/resources/assets/lang/I18N.properties 英文:更新渲染器描述并新增 Vulkan/Lavapipe/OpenGL 等条目文案
HMCL/src/main/resources/assets/lang/I18N_zh.properties 繁中:更新/新增渲染器条目文案
HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties 简中:更新/新增渲染器条目文案
HMCL/src/main/resources/assets/lang/I18N_uk.properties 删除既有渲染器 desc 翻译行
HMCL/src/main/resources/assets/lang/I18N_ru.properties 删除既有渲染器 desc 翻译行
HMCL/src/main/resources/assets/lang/I18N_lzh.properties 删除既有渲染器 desc 翻译行
HMCL/src/main/resources/assets/lang/I18N_ja.properties 删除既有渲染器 desc 翻译行
HMCL/src/main/resources/assets/lang/I18N_es.properties 删除既有渲染器 desc 翻译行
HMCL/src/main/resources/assets/lang/I18N_ar.properties 删除既有渲染器 desc 翻译行
HMCL/src/main/java/org/jackhuang/hmcl/util/NativePatcher.java 调整 Mesa Loader 获取方法的参数命名与引用一致性
HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/AdvancedVersionSettingPage.java 按游戏版本控制渲染器下拉可选项(>= 26.2 snapshot 显示更多选项)
HMCL/src/main/java/org/jackhuang/hmcl/game/LauncherHelper.java Windows 下为 Mesa 渲染器注入 javaagent 参数时改用 Mesa driverName

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 1207 to 1211
settings.advanced.renderer=Рендерер
settings.advanced.renderer.default=По умолчанию
settings.advanced.renderer.default.desc=OpenGL
settings.advanced.renderer.d3d12=Mesa D3D12
settings.advanced.renderer.d3d12.desc=DirectX 12 (Погана продуктивність та сумісність)
settings.advanced.renderer.llvmpipe=Mesa LLVMpipe
settings.advanced.renderer.llvmpipe.desc=Програмний (Погана продуктивність, найкраща сумісність)
settings.advanced.renderer.zink=Mesa Zink
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change removes existing localized renderer description keys. As a result, this locale will fall back to English for these descriptions (or show them missing depending on bundle fallback), which is a regression for non-English users. Please keep the previous translations or update them to match the new wording instead of deleting.

Copilot uses AI. Check for mistakes.
Comment on lines 1086 to 1090
settings.advanced.renderer=繪器
settings.advanced.renderer.default=本
settings.advanced.renderer.default.desc=開圖庫
settings.advanced.renderer.d3d12=Mesa D3D12
settings.advanced.renderer.d3d12.desc=DirectX 12 (效與所適皆差,勘誤之用)
settings.advanced.renderer.llvmpipe=Mesa LLVMpipe
settings.advanced.renderer.llvmpipe.desc=軟繪器 (效差,所適至)
settings.advanced.renderer.zink=Mesa Zink
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change removes existing localized renderer description keys. As a result, this locale will fall back to English for these descriptions (or show them missing depending on bundle fallback), which is a regression for non-English users. Please keep the previous translations or update them to match the new wording instead of deleting.

Copilot uses AI. Check for mistakes.
Comment on lines 793 to 797
settings.advanced.renderer=レンダラー
settings.advanced.renderer.default=デフォルト
settings.advanced.renderer.default.desc=OpenGL
settings.advanced.renderer.d3d12=Mesa D3D12
settings.advanced.renderer.d3d12.desc=DirectX 12 (低パフォーマンス、低互換性)
settings.advanced.renderer.llvmpipe=Mesa LLVMpipe
settings.advanced.renderer.llvmpipe.desc=ソフトウェア (低速だが、互換性は最高)
settings.advanced.renderer.zink=Mesa Zink
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change removes existing localized renderer description keys. As a result, this locale will fall back to English for these descriptions (or show them missing depending on bundle fallback), which is a regression for non-English users. Please keep the previous translations or update them to match the new wording instead of deleting.

Copilot uses AI. Check for mistakes.
Comment on lines 1269 to 1273
settings.advanced.renderer=Renderizador
settings.advanced.renderer.default=Por defecto
settings.advanced.renderer.default.desc=OpenGL
settings.advanced.renderer.d3d12=Mesa D3D12
settings.advanced.renderer.d3d12.desc=DirectX 12 (Rendimiento y compatibilidad deficientes)
settings.advanced.renderer.llvmpipe=Mesa LLVMpipe
settings.advanced.renderer.llvmpipe.desc=Software (Bajo rendimiento, máxima compatibilidad)
settings.advanced.renderer.zink=Mesa Zink
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change removes existing localized renderer description keys. As a result, this locale will fall back to English for these descriptions (or show them missing depending on bundle fallback), which is a regression for non-English users. Please keep the previous translations or update them to match the new wording instead of deleting.

Copilot uses AI. Check for mistakes.
Comment on lines 1365 to 1369
settings.advanced.renderer=المُصيِّر
settings.advanced.renderer.default=افتراضي
settings.advanced.renderer.default.desc=OpenGL
settings.advanced.renderer.d3d12=Mesa D3D12
settings.advanced.renderer.d3d12.desc=DirectX 12 (أداء وتوافق ضعيفان)
settings.advanced.renderer.llvmpipe=Mesa LLVMpipe
settings.advanced.renderer.llvmpipe.desc=برمجي (أداء ضعيف، توافق أفضل)
settings.advanced.renderer.zink=Mesa Zink
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change removes existing localized renderer description keys. As a result, this locale will fall back to English for these descriptions (or show them missing depending on bundle fallback), which is a regression for non-English users. Please keep the previous translations or update them to match the new wording instead of deleting.

Copilot uses AI. Check for mistakes.
@Glavo
Copy link
Copy Markdown
Member Author

Glavo commented Apr 10, 2026

@codex review

1 similar comment
@Glavo
Copy link
Copy Markdown
Member Author

Glavo commented Apr 10, 2026

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3cccec02b8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +644 to +648
if (renderer.getApi() == Renderer.API.VULKAN) {
String icdFile = FileUtils.getAbsolutePath(nativeFolder.resolve("mesa-loader/" + renderer.getIcdFileName()));

env.put("VK_ICD_FILENAMES", icdFile);
env.put("VK_DRIVER_FILES", icdFile);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Guard Vulkan ICD env vars by available Windows loader

This path unconditionally sets VK_ICD_FILENAMES/VK_DRIVER_FILES for Vulkan Mesa renderers on Windows, but the loader agent is only attached when NativePatcher.getWindowsMesaLoader(...) returns a library; on Windows 7/8 it returns null for non-LLVMPIPE. In that case (e.g., LAVAPIPE), the process is forced to use an ICD file under mesa-loader that was never extracted, so Vulkan startup fails. Please gate these env vars by Windows version/loader availability (or block unsupported renderer selection earlier).

Useful? React with 👍 / 👎.

Comment on lines +200 to +201
if (gameVersion == null || gameVersion.compareTo("26.2-snapshot-1") >= 0) {
rendererPane.setItems(Renderer.ALL);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Align renderer availability gate with backend flag support

The UI enables Renderer.ALL starting at 26.2-snapshot-1, but launch argument generation only applies --graphicsBackend from 26.2-snapshot-2 onward (DefaultLauncher lines 404-407). For 26.2-snapshot-1, selecting OPENGL/VULKAN has no effective launch-time change (no Mesa driver/env path), so users can choose options that silently do nothing. The version gate should match the backend-flag support threshold.

Useful? React with 👍 / 👎.

@Glavo
Copy link
Copy Markdown
Member Author

Glavo commented Apr 10, 2026

/gemini review

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for selecting the Graphics API (OpenGL or Vulkan) in the game settings, specifically targeting Minecraft 26.2 and later. Key changes include updating the Mesa loader to version 26.0.4, refactoring the Renderer enum to associate specific renderers with their respective APIs, and adding UI components for backend selection. The launch logic has been updated to handle the new --graphicsBackend argument and configure environment variables for various rendering backends on both Windows and Linux. Review feedback identifies a type mismatch during UI initialization, a typo in a code comment, and a missing environment variable configuration for the D3D12 renderer on Linux.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 20 out of 20 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Glavo
Copy link
Copy Markdown
Member Author

Glavo commented Apr 10, 2026

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Glavo Glavo merged commit 30c3acf into HMCL-dev:main Apr 10, 2026
2 checks passed
@Glavo Glavo deleted the vulkan branch April 10, 2026 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants